<template>
  <div id="app">
    <h2>{{message}}</h2>
    <h2>{{$store.state.counter}}</h2>
    <button @click="subtion">-</button>
    <button @click="addtion">+</button>
    <hello-world></hello-world>
    <h2>{{$store.getters.powerCounter}}</h2>
  </div>
</template>

<script>
import HelloWorld from './components/HelloWorld'

export default {
  name: 'App',
  components: {
    HelloWorld
  },
  data() {
    return {
      message: '我是App组件',
      counter: 0
    }
  },
  methods: {
    addtion(){
      this.$store.commit('add')
    },
    subtion(){
      this.$store.commit('sub')
    }
  }
}
</script>

<style>

</style>
